<template>
  <ul id="car-list">
    <li class="car-item" v-for="item of mycarInfo">
      <div class="weui-cells">
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>车牌号</p>
          </div>
          <div class="weui-cell__ft">{{item.carCode}}</div>
        </div>
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>车品牌</p>
          </div>
          <div class="weui-cell__ft">{{item.carBrand}}</div>
        </div>
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>车型号</p>
          </div>
          <div class="weui-cell__ft">{{item.carModel}}</div>
        </div>
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>年检日期</p>
          </div>
          <div class="weui-cell__ft">{{item.checkDate | formatDate}}</div>
        </div>
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>合同起始日期</p>
          </div>
          <div class="weui-cell__ft">{{item.contracrtDate | formatDate}}</div>
        </div>
        <div class="weui-cell">
          <div class="weui-cell__bd">
            <p>合同到期日期</p>
          </div>
          <div class="weui-cell__ft">{{item.expireDate | formatDate}}</div>
        </div>
      </div>
      <!--正在加载提示框-->
    <li is="loading" v-if="loadShow"></li>
    <!--加载失败弹框-->
    <li is="dialog-box" :message="dialogMessage" v-if="dialogShow" @close-dialog="closeDialog" @cancle-dialog="closeDialog"></li>
    </li>
    <li class="no_data" v-if="!mycarInfo.length">
      <i class="ion ion-ios-paper-outline"></i>
      <p>暂无数据</p>
    </li>
  </ul>
</template>
<script type="text/javascript">
  import '../../assets/css/mycar.scss';
  import interfaceAPI from '../../assets/js/insterface.js';
  import http from '../../assets/js/http_mixin'
  var carUrl = interfaceAPI.carUrl;
  export default{
    data(){
      return {
        mycarInfo: []
      }
    },
    mixins: [http],
    mounted(){
      document.title = '我的车辆';
      this.getInfo({
        url: carUrl,
        param: {
          'num': this.$route.query.empNo
        },
        success: function (response) {
          if (response.body.resultCode === '1') {
            this.mycarInfo = response.body.resultData;
            return false;
          }
          /*this.dialogMessage = '没有查询到相关数据！';
           this.dialogShow = true;*/
        },
        fail: function (response) {
          this.dialogMessage = '请求失败，请稍后再试';
          this.dialogShow = true;
        }
      })
    }

  }
</script>
